Imports System.ComponentModel

<Serializable()> _
Public Class Section1
    Inherits BaseDescriptor

    '0.9.5
    Private MAX_VOLT As Double = 99.9
    Private MIN_VOLT As Double = -99.9

    'S1C1
    Private _STV1 As Double
    Private _VJUMP1 As Double
    Private _STV2 As Double
    Private _VJUMP2 As Double
    Private _STV3 As Double
    Private _VJUMP3 As Double
    Private _STV4 As Double
    'S1C2
    Private _VOLT1 As Double
    Private _VOLT2 As Double
    'S1C3
    Private _ILIGHT1 As Integer
    Private _LIGHT_X_1 As Double
    Private _ILIGHT2 As Integer
    Private _LIGHT_X_2 As Double
    'S1C4
    Private _NIP As Integer
    'S1C6
    Private _IRSRSH As Integer
    Private _RS As Double
    Private _RSH As Double
    'S1C7
    Private _ISR As Integer
    Private _ISRBOTH As Integer = 1
    Private _SRFLUX As Double

    <CustomOrder(1), CustomCategory("S1C1"), CustomDisplayName("STV1"), CustomDescription("STV1"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property STV1() As Double
        Get
            Return _STV1
        End Get
        Set(ByVal value As Double)
            _STV1 = value
        End Set
    End Property

    <CustomOrder(2), CustomCategory("S1C1"), CustomDisplayName("VJUMP1"), CustomDescription("VJUMP1"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property VJUMP1() As Double
        Get
            Return _VJUMP1
        End Get
        Set(ByVal value As Double)
            _VJUMP1 = value
        End Set
    End Property

    <CustomOrder(3), CustomCategory("S1C1"), CustomDisplayName("STV2"), CustomDescription("STV2"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property STV2() As Double
        Get
            Return _STV2
        End Get
        Set(ByVal value As Double)
            _STV2 = value
        End Set
    End Property

    <CustomOrder(4), CustomCategory("S1C1"), CustomDisplayName("VJUMP2"), CustomDescription("VJUMP2"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property VJUMP2() As Double
        Get
            Return _VJUMP2
        End Get
        Set(ByVal value As Double)
            _VJUMP2 = value
        End Set
    End Property

    <CustomOrder(5), CustomCategory("S1C1"), CustomDisplayName("STV3"), CustomDescription("STV3"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property STV3() As Double
        Get
            Return _STV3
        End Get
        Set(ByVal value As Double)
            _STV3 = value
        End Set
    End Property

    <CustomOrder(6), CustomCategory("S1C1"), CustomDisplayName("VJUMP3"), CustomDescription("VJUMP3"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property VJUMP3() As Double
        Get
            Return _VJUMP3
        End Get
        Set(ByVal value As Double)
            _VJUMP3 = value
        End Set
    End Property

    <CustomOrder(7), CustomCategory("S1C1"), CustomDisplayName("STV4"), CustomDescription("STV4"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property STV4() As Double
        Get
            Return _STV4
        End Get
        Set(ByVal value As Double)
            _STV4 = value
        End Set
    End Property

    <CustomOrder(1), CustomCategory("S1C2"), CustomDisplayName("VOLT1"), CustomDescription("VOLT1"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property VOLT1() As Double
        Get
            Return _VOLT1
        End Get
        Set(ByVal value As Double)
            '0.9.5
            '_VOLT1 = Math.Round(value, 1)
            If value < MIN_VOLT Then
                _VOLT1 = MIN_VOLT
            ElseIf value <= -10 Then
                _VOLT1 = Math.Round(value, 1)
            Else
                _VOLT1 = Math.Round(value, 2)
            End If
        End Set
    End Property

    <CustomOrder(2), CustomCategory("S1C2"), CustomDisplayName("VOLT2"), CustomDescription("VOLT2"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property VOLT2() As Double
        Get
            Return _VOLT2
        End Get
        Set(ByVal value As Double)
            '0.9.5
            '_VOLT2 = Math.Round(value, 1)
            If value > MAX_VOLT Then
                _VOLT2 = MAX_VOLT
            ElseIf value >= 10 Then
                _VOLT2 = Math.Round(value, 1)
            Else
                _VOLT2 = Math.Round(value, 2)
            End If
        End Set
    End Property

    <CustomOrder(1), CustomCategory("S1C3"), CustomDisplayName("ILIGHT1"), CustomDescription("ILIGHT1"), DefaultValue(0), TypeConverter(GetType(CustomInt32ConverterONOFF))> _
    Public Property ILIGHT1() As Object
        Get
            Return _ILIGHT1
        End Get
        Set(ByVal value As Object)
            _ILIGHT1 = CInt((New CustomInt32ConverterONOFF).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(2), CustomCategory("S1C3"), CustomDisplayName("LIGHT_X_1"), CustomDescription("LIGHT_X_1"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property LIGHT_X_1() As Double
        Get
            Return _LIGHT_X_1
        End Get
        Set(ByVal value As Double)
            _LIGHT_X_1 = value
        End Set
    End Property

    <CustomOrder(3), CustomCategory("S1C3"), CustomDisplayName("ILIGHT2"), CustomDescription("ILIGHT2"), DefaultValue(0), TypeConverter(GetType(CustomInt32ConverterONOFF))> _
    Public Property ILIGHT2() As Object
        Get
            Return _ILIGHT2
        End Get
        Set(ByVal value As Object)
            _ILIGHT2 = CInt((New CustomInt32ConverterONOFF).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(4), CustomCategory("S1C3"), CustomDisplayName("LIGHT_X_2"), CustomDescription("LIGHT_X_2"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property LIGHT_X_2() As Double
        Get
            Return _LIGHT_X_2
        End Get
        Set(ByVal value As Double)
            _LIGHT_X_2 = value
        End Set
    End Property

    <CustomOrder(1), CustomCategory("S1C4"), CustomDisplayName("NIP"), CustomDescription("NIP"), DefaultValue(0), TypeConverter(GetType(CustomInt32ConverterNIP))> _
    Public Property NIP() As Object
        Get
            Return _NIP
        End Get
        Set(ByVal value As Object)
            _NIP = CInt((New CustomInt32ConverterNIP).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(1), CustomCategory("S1C5"), CustomDisplayName("IRSRSH"), CustomDescription("IRSRSH"), DefaultValue(0), TypeConverter(GetType(CustomInt32ConverterYESNO))> _
    Public Property IRSRSH() As Object
        Get
            Return _IRSRSH
        End Get
        Set(ByVal value As Object)
            _IRSRSH = CInt((New CustomInt32ConverterYESNO).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(2), CustomCategory("S1C5"), CustomDisplayName("RS"), CustomDescription("RS"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property RS() As Double
        Get
            Return _RS
        End Get
        Set(ByVal value As Double)
            _RS = value
        End Set
    End Property

    <CustomOrder(3), CustomCategory("S1C5"), CustomDisplayName("RSH"), CustomDescription("RSH"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property RSH() As Double
        Get
            Return _RSH
        End Get
        Set(ByVal value As Double)
            _RSH = value
        End Set
    End Property

    <CustomOrder(1), CustomCategory("S1C6"), CustomDisplayName("ISR"), CustomDescription("ISR"), DefaultValue(0), TypeConverter(GetType(CustomInt32ConverterYESNO))> _
    Public Property ISR() As Object
        Get
            Return _ISR
        End Get
        Set(ByVal value As Object)
            _ISR = CInt((New CustomInt32ConverterYESNO).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(2), CustomCategory("S1C6"), CustomDisplayName("ISRBOTH"), CustomDescription("ISRBOTH"), DefaultValue(1), TypeConverter(GetType(CustomInt32ConverterISRBOTH))> _
    Public Property ISRBOTH() As Object
        Get
            Return _ISRBOTH
        End Get
        Set(ByVal value As Object)
            _ISRBOTH = CInt((New CustomInt32ConverterISRBOTH).ConvertFrom(value))
        End Set
    End Property

    <CustomOrder(3), CustomCategory("S1C6"), CustomDisplayName("SRFLUX"), CustomDescription("SRFLUX"), DefaultValue(0.0), TypeConverter(GetType(CustomDoubleConverter))> _
    Public Property SRFLUX() As Double
        Get
            Return _SRFLUX
        End Get
        Set(ByVal value As Double)
            _SRFLUX = value
        End Set
    End Property

End Class
